package com.zhongxi.guoyuan.widget.shaketree.controller;

import android.os.Handler;
import android.os.Message;

public class MainPresentorImp implements MainContract.MainPresenter {

	public static final int SUCCESS=0x11;
	public static final int FALUSE=0x22;
	private MainContract.MainView mainView;

	public MainPresentorImp(){
	}

	public MainContract.MainModle getMainModle(){return mainModle;}

	public void setMainModle(MainContract.MainModle mainModle){this.mainModle = mainModle;}

	public MainContract.MainView getMainView(){return mainView;}

	public void setMainView(MainContract.MainView mainView){this.mainView = mainView; }

	private MainContract.MainModle mainModle;

	public MainPresentorImp(MainContract.MainModle mainModle, MainContract.MainView mainView){
		this.mainModle = mainModle;
		this.mainView = mainView;
	}

	public Handler handler =new Handler(){
		@Override
		public void handleMessage(Message msg) {
			switch(msg.what){
			case SUCCESS:
				mainView.onShake(true);
				break;
			case FALUSE:
				mainView.onShake(false);
				break;
			}
		}
	};

	@Override
	public void shake() {
		mainModle.shake();
	}

	@Override
	public void onDestroy() {
		mainModle.onDestory();
	}

}
